package org.oncase.smcase;

import org.oncase.smcase.controller.ActivityController;
import org.oncase.smcase.controller.ActivityControllerImpl;
import org.oncase.smcase.controller.ObjectiveController;
import org.oncase.smcase.controller.ObjectiveControllerImpl;
import org.oncase.smcase.controller.PerspectiveController;
import org.oncase.smcase.controller.PerspectiveControllerImpl;
import org.oncase.smcase.dao.ActivityDAO;
import org.oncase.smcase.dao.FrequencyDAO;
import org.oncase.smcase.dao.HibernateDAO;
import org.oncase.smcase.dao.ObjectiveDAO;
import org.oncase.smcase.dao.PerspectiveDAO;
import org.oncase.smcase.entity.Frequency;
import org.oncase.smcase.util.TransactionalContext;

import com.google.inject.Binder;
import com.google.inject.Module;

public class BSCModule implements Module {
	
	@Override
	public void configure(Binder binder) {
		
		PerspectiveDAO perspectiveDAO = new PerspectiveDAO();
		
		binder.bind(PerspectiveController.class)
			.toInstance((PerspectiveController)
					TransactionalContext.newInstance(
							new PerspectiveControllerImpl(perspectiveDAO)));
		
		ObjectiveDAO objectiveDAO = new ObjectiveDAO();
		FrequencyDAO frequencyDAO = new FrequencyDAO();
		
		binder.bind(ObjectiveController.class)
			.toInstance((ObjectiveController)
					TransactionalContext.newInstance(
							new ObjectiveControllerImpl(objectiveDAO, frequencyDAO)));
		
		ActivityDAO activityDAO = new ActivityDAO();
		
		binder.bind(ActivityController.class)
			.toInstance((ActivityController)
					TransactionalContext.newInstance(
							new ActivityControllerImpl(activityDAO, objectiveDAO)));
		
	}

}
